package com.ruoyi.performance.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.performance.domain.PerfCheck;
import com.ruoyi.performance.domain.PerfCheckreport;
import com.ruoyi.performance.service.IPerfCheckreportService;
import com.ruoyi.performance.utils.MyUtils;

/**
 * 绩效报告单 提供者
 * 
 * @author ygx
 * @date 2020-09-06
 */
@RestController
@RequestMapping("checkreport")
public class PerfCheckreportController extends MyUtils
{
	
	@Autowired
	private IPerfCheckreportService perfCheckreportService;
	
	/**
	 * 查询${tableComment}
	 */
	@GetMapping("get/{perfcheckreportId}")
	public PerfCheckreport get(@PathVariable("perfcheckreportId") Long perfcheckreportId)
	{
		return perfCheckreportService.selectPerfCheckreportById(perfcheckreportId);
		
	}
	
	/**
	 * 查询绩效报告单列表
	 */
	@GetMapping("list")
	public R list(PerfCheckreport perfCheckreport)
	{
		startPage();
        return result(perfCheckreportService.selectPerfCheckreportList(perfCheckreport));
	}
	
	/**
	 * 查询绩效报告单列表
	 */
	@GetMapping("yearList")
	public R yearList(PerfCheckreport perfCheckreport)
	{
		startPage();
        return result(perfCheckreportService.selectPerfCheckreportYearList(perfCheckreport));
	}
	
	/**
	 * 新增保存绩效报告单
	 */
	@PostMapping("save")
	public R addSave(@RequestBody PerfCheckreport perfCheckreport)
	{		
		return toAjax(perfCheckreportService.insertPerfCheckreport(perfCheckreport));
	}

	/**
	 * 修改保存绩效报告单
	 */
	@PostMapping("update")
	public Map<String, String> editSave(@RequestBody  Map<String,List<PerfCheckreport>>  datas)
	{		
		return jacResultMsg(perfCheckreportService.updatePerfCheckreport(datas));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public R remove(String ids)
	{		
		return toAjax(perfCheckreportService.deletePerfCheckreportByIds(ids));
	}
	
}
